package com.shell.arouter.demo.multitype;

import androidx.annotation.NonNull;
import com.durian.base.utils.LogUtils;
import com.durian.base.utils.ToastUtils;
import com.durian.ui.adapter.multi.ItemViewBindingProvider;
import com.durian.ui.adapter.multi.MultiItemViewBindingHolder;
import com.durian.ui.adapter.multi.OnItemClickListener;
import com.henanjianye.soon.communityo2o2.databinding.ItemMulOneABinding;

/**
 * 说明：OneA
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2019-11-12 16:49
 * <p/>
 * 版本：version 1.0
 */
public class OneA extends ItemViewBindingProvider<ItemMulOneABinding,OneA.A> {

    public OneA(){
        setOnItemClickListener(new OnItemClickListener<A>() {
            @Override
            public void onItemClick(int position, A item) {
                ToastUtils.get().shortToast("A---" + item.name);
            }
        });
    }

    @Override
    protected void convert(MultiItemViewBindingHolder<ItemMulOneABinding> holder, @NonNull ItemMulOneABinding viewBinding, @NonNull A item, int position) {
        viewBinding.tvNameA.setText("A---" + item.name);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        LogUtils.e("fanly","OneA destroy()");
    }

    public static class A {
        public String name;

        public A(String name) {
            this.name = name;
        }
    }

}
